Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Grouping assignments with the ASSIGN statement
If you are assigning two or more values in a row, it is significantly faster to assign them all in a single statement using the
ASSIGNkeyword. Even if the values being assigned have nothing to do with one another, it is faster to do it in a single statement, as in this example:
Here the code is setting an attribute on a procedure handle, a variable, and a field attribute. Even though these are unrelated, it is still best to
ASSIGNthem together.If you are assigning multiple field values within a single record buffer, the
ASSIGNstatement can be even more important. Progress adjusts index entries and does other work as part of each statement. If you assign two fields that participate in the same index in two separate statements, the index block is rebuilt once after each statement—a much greater overhead than doing it in one statement. In fact, because Progress assigns index entries at the end of each statement, you might even cause a temporary (but fatal) unique index violation if you assign part of a composite key in one statement and the other part in another. Don’t ever do this.Because of the efficiency of an
ASSIGNstatement without multiple assignments, some Progress developers always use theASSIGNkeyword even when the statement only does one assignment. There is no advantage to this. That is, these two statements are comparably fast:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |